package org.halk.repository;

import org.halk.pojo.entity.StudentCountVO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @Author halk
 * @Date 2023/8/4 21:43
 */
public interface StudentCountVORepository extends JpaRepository<StudentCountVO, Integer> {

    @Query(nativeQuery = true, value = "" +
            "select max(id) id, name, age, count(1) countNumber from student_test group by name, age")
    List<StudentCountVO> countByNameAndAge();
}
